<!--
 * @Author: 陈良财
 * @Date: 2020-07-09 15:53:49
 * @LastEditTime: 2020-07-10 15:04:19
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \jingkai_open_source_system\jingkaisystem\src\pages\information\information.vue
--> 
<template>
  <div class="home">
    <table border=1; cellpadding=12; cellspacing=0; align=center>
		<tr align=center class="xx">
			<td colspan="5">基本信息</td>
		</tr>
		<tr align=center>
			<td>姓名:</td><td>{{userinfo.name}}</td>
			<td>班级:</td><td>{{userinfo.cname}}</td>
			<td rowspan="5"></td>
		</tr>
	

		<tr align=center>
			<td>学校:</td><td>{{userinfo.school}}</td>
			<td>出生日期:</td><td>{{userinfo.birth}}</td>
		</tr>

		<tr align=center>
			<td>籍贯:</td><td>{{userinfo.birthplace}}</td>
			<td>手机号码:</td><td>{{userinfo.phone}}</td>
		</tr>
		<tr align=center>
			<td>地址:</td><td colspan="4">{{userinfo.addr}}</td>
		</tr>
	
		<tr align=center>
			<td colspan="5">本月考试安排次数:</td>
		</tr>
		<tr align=center>
			<td colspan="5" style="height:100px">{{examNum}}</td>
		</tr>
		<tr align=center>
			<td colspan="5"> 您已考试次数:</td>
		</tr>
		<tr align=center>
			<td colspan="5" style="height:100px">{{subexamNum}}</td>
		</tr>
		<tr align=center>
			<td colspan="5">您的参考率:</td>
		</tr>
		<tr align=center>
			<td colspan="5" style="height:100px">{{subexamPer}}%</td>
		</tr>

	</table>

  </div>
</template>

<script>
import stroage from "@/utils/storage.js"
import * as api1 from "@/api/apiList/home";
export default {
  data() {
    return {
      userinfo: [],
      examNum: 0, //本月安排考试次数
      subexamNum: 0, //已参加考试次数
      subexamPer: 0 //参考率
    };
  },
  methods: {
    async API_examNum(cid) {
      //获取考试次数
      let params = {
        cid
      };
      return await api1.examNum(this.qs.stringify(params));
    }
  },
  async created() {
    this.userinfo = stroage.get("userInfo"); //获取用户登录信息

    // console.log(this.userinfo)


    console.log(this.userinfo);
    let res2 = await this.API_examNum(this.userinfo.clzid);
    if (res2.data.statusCode == 200) {
      this.examNum = res2.data.content.examCount;
      this.subexamNum = res2.data.content.answerCount;
      this.subexamPer = parseInt((this.subexamNum / this.examNum) * 100);
    }
    console.log(res2);
  }
};
</script>

<style lang="scss">

		.home{
			margin:0 auto;
			padding:0;
		}
		td{
			width:160px;
			height:30px;
			font-size:20px;
		}
		.xx{
			background:#0077af;
			color:#eff;
		}	
</style>
